package com.fdd.op.demo;

import com.fdd.op.sdk.ApiException;
import com.fdd.op.sdk.DefaultFddClient;
import com.fdd.op.sdk.constants.Constants;
import com.fdd.op.sdk.internal.token.FddTokenStore;
import com.fdd.op.sdk.internal.token.stroe.CacheTokenStoreImpl;
import com.fdd.op.sdk.request.api.contract.CheckSignatureRequest;
import com.fdd.op.sdk.request.api.contract.GetDetailRequest;
import com.fdd.op.sdk.response.api.contract.CheckSignatureResponse;
import com.fdd.op.sdk.response.api.contract.GetDetailResponse;

public class GetDetailApi {
    private static String serverUrl = "http://10.21.8.20:37801/";
    private static final String appId = "486478";
    private static final String appKey = "xguUMVFnDzqJgfVEDnLW16yE2mxVL2Fp";

    public static void main(String[] args) throws ApiException {
        FddTokenStore tokenStore = new CacheTokenStoreImpl();
        DefaultFddClient fddClient = new DefaultFddClient(serverUrl, appId, appKey, Constants.AUTH_OAUTH, 1000, 30000);
        fddClient.tokenStore(tokenStore);
        GetDetailRequest request = new GetDetailRequest();
        request.setDocId("351063836567142400");
        GetDetailResponse response = fddClient.execute(request);
        if(response != null && "0".equals(response.getCode())){
            System.out.println(response.getData());
        }
    }
}
